/*
 * @Author: wjk
 * @Date: 2020-11-27 16:39:00
 * @LastEditors: wjk
 * @LastEditTime: 2020-12-14 14:46:47
 * @description: file content
 */
import { requestNew } from '@/utils/request'

// 获取首页展示分类和广告
export async function getMaterialCategory(params = {}) {
  const res = await requestNew({
    url: '/social-material-category/index-list',
    method: 'get',
    params
  })
  return res
}

// 获取某一分类的所有子类包含全部
export async function getSubCategoryAll(params) {
  const res = await requestNew({
    url: '/social-material-category/index-child-list',
    method: 'get',
    params
  })
  return res
}

// 获取种草标签
export async function getMaterialTag(params) {
  const res = await requestNew({
    url: '/social-material-category/get-zhongcao-types',
    method: 'get',
    params
  })
  return res
}

// 获取某一分类下的素材分页列表
export async function getCategoryMaterial(params) {
  const res = await requestNew({
    url: '/social-material/get-list',
    method: 'get',
    params
  })
  return res
}

// 获取产品素材分页列表
export async function getProductMaterial(params) {
  const res = await requestNew({
    url: '/social-material/get-product-list',
    method: 'get',
    params
  })
  return res
}

// 随机列表-根据类型区分
export async function getRandomMaterial(params) {
  const res = await requestNew({
    url: '/social-material/get-random-list',
    method: 'get',
    params
  })
  return res
}

// 获s取某一用户的素材列表
export async function getUserList(params) {
  const res = await requestNew({
    url: '/social-material/get-user-list',
    method: 'get',
    params
  })
  return res
}
// 获取产品素材详情
export async function getMaterialDetail(params) {
  const res = await requestNew({
    url: '/social-material/get-detail',
    method: 'get',
    params
  })
  return res
}

// 获取推荐文章列表
export async function getRecommendList(params) {
  const res = await requestNew({
    url: '/social-material/get-article-recommond',
    method: 'get',
    params
  })
  return res
}

// 获取推荐文章列表
export async function getRecommendGuest(params) {
  const res = await requestNew({
    url: '/social-material/get-recommond-list',
    method: 'get',
    params
  })
  return res
}

// 复制素材
export async function materialCopy(params) {
  const res = await requestNew({
    url: '/social-material/copy',
    method: 'get',
    params
  })
  return res
}

// 数据统计
export async function materialCount(params) {
  const res = await requestNew({
    url: '/social-material/count',
    method: 'post',
    params,
    headers: {
      'Content-Type': 'application/json',
      'showLoading': false
    }
  })
  return res
}

// 删除某一素材
export async function materialDelete(params) {
  const res = await requestNew({
    url: '/social-material/delete-material',
    method: 'get',
    params
  })
  return res
}

// 删除搜索记录
export async function searchDelete(params) {
  const res = await requestNew({
    url: '/social-material/search-delete',
    method: 'get',
    params
  })
  return res
}

// 获取最近热词
export async function searchKey(params) {
  const res = await requestNew({
    url: '/social-material/search-key',
    method: 'get',
    params
  })
  return res
}

// 搜索素材分页列表
export async function searchList(params) {
  const res = await requestNew({
    url: '/social-material/search-list',
    method: 'get',
    params
  })
  return res
}

// 提交素材
export async function materialSubmit(params) {
  const res = await requestNew({
    url: '/social-material/submit',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params
  })
  return res
}

// 去学习记录
export async function toStudy(params) {
  const res = await requestNew({
    url: '/social-material/to-study',
    method: 'get',
    params,
    headers: {
      showLoading: false
    }
  })
  return res
}

/** 个人主页相关 */

// 关注
export async function attentionOperator(data) {
  const res = await requestNew({
    url: '/social-material/home/attention-operator',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
  return res
}

// 我的关注
export async function myAttention(params) {
  const res = await requestNew({
    url: '/social-material/home/my-attention',
    method: 'get',
    params
  })
  return res
}

// 我的粉丝
export async function getMyFans(params) {
  const res = await requestNew({
    url: '/social-material/home/my-fans',
    method: 'get',
    params
  })
  return res
}

// 我的点赞
export async function myPraise(params) {
  const res = await requestNew({
    url: '/social-material/home/my-praise',
    method: 'get',
    params
  })
  return res
}

// 点赞操作
export async function praiseOperator(data) {
  const res = await requestNew({
    url: '/social-material/home/praise-operator',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
  return res
}

// 收到的赞
export async function receivedPraise(params) {
  const res = await requestNew({
    url: '/social-material/home/received-praise',
    method: 'get',
    params
  })
  return res
}

// 素材圈个人主页
export async function getMyHome(params) {
  const res = await requestNew({
    url: '/social-material/home/' + params.user_id,
    method: 'get',
    params
  })
  return res
}

// 素材圈个人足迹
export async function getViewHistory(params) {
  const res = await requestNew({
    url: '/view-history/list',
    method: 'get',
    params
  })
  return res
}

/**
 * @Author: wjk
 * @Date: 2020-03-17 10:36:11
 * @LastEditors: wjk
 * @description: 直播房间分页查询
 * @param {anchorId} 主播Id
 * @param {liveStatus} 直播状态   1;//创建失败 2;//待开始（预告） 3;//直播中 4;//暂停 5;//正常结束（回放） 6;//违规下线 7;//超时作废
 * @param {pageNo} 页码
 * @param {pageSize} 条数
 * @return: 分页列表
 */
export async function getLiveRoundAll(params = {}) {
  const res = await requestNew({
    url: '/live-bx-app-api/live-round/home-page/my-query',
    method: 'get',
    params
  })
  return res
}
